package com.open.capacity.reimburse.controller;

import java.util.List;
import java.util.Map;

import com.open.capacity.commons.Result;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
import com.open.capacity.reimburse.entity.BillFeeProjectAssign;
import com.open.capacity.reimburse.service.BillFeeProjectAssignService;

import com.open.capacity.commons.PageResult;

import javax.validation.Valid;

/**
 * 报销费用项目分配
 *
 * @author
 * @email
 * @date 2021-11-24 14:28:09
 */
@RestController
@RequestMapping("billfeeprojectassigns")
@Api(tags = "报销费用项目分配")
public class BillFeeProjectAssignController {

    @Autowired
    private BillFeeProjectAssignService billFeeProjectAssignService;

    /**
     * 查询单条记录
     */
    @RequestMapping("/findByProcessId")
    @PreAuthorize("hasAnyAuthority('bill_fee_project_assign:billfeeprojectassign:list')")
    public Result findByProcessId(String id) {
        return Result.succeed(billFeeProjectAssignService.findByProcessId(id));
    }

    /**
     * 保存
     */
    @RequestMapping("/saveOrUpdate")
    @PreAuthorize("hasAnyAuthority('bill_fee_project_assign:billfeeprojectassign:save')")
    public Result save(@RequestBody @Valid List<BillFeeProjectAssign> assignList) {
        billFeeProjectAssignService.save(assignList);
        return Result.succeed("保存成功");
    }


}
